2024-04-15

Adding images to viz

There are multiple ways we can add (potentially humanizing) images to visualizations, including

  • Add background images to figures
  • Use images as points
  • Use images in axes, to represent different attributes

A good (quick) video demonstrating some of these approaches by Albert Rapp.

ggimage::geom_image() example

Interactive viz

The plotly package provides a way of using the plotly.js library within R

  • By creating a plotly object with plot_ly()
  • By transforming a ggplot object via ggplotly()

ggplotly() provides a lot of the functionality of plot_ly() without learning the details of plot_ly(). Because ggplotly() returns a plot_ly() object, though, it can be modified with additional plot_ly() options.

See Carson Sievert’s book for more, especially Chapter 2 and Chapter 33!

plot_ly::ggplotly() example

Interactive tables

The reactable package provides a way of using the React Table JavaScript library within R

  • Has interactive functionality (sorting, filtering) like DT::datatable()
  • With more formatting and conditionaly styling like kableExtra

With additional and simplified formatting and customization provided in the reactablefmtr package.

Let’s Play with R!

Don’t forget to comment your code!